# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapoint do
  @moduledoc """
  A datapoint of Index.

  ## Attributes

  *   `crowdingTag` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointCrowdingTag.t`, *default:* `nil`) - Optional. CrowdingTag of the datapoint, the number of neighbors to return in each crowding can be configured during query.
  *   `datapointId` (*type:* `String.t`, *default:* `nil`) - Required. Unique identifier of the datapoint.
  *   `featureVector` (*type:* `list(number())`, *default:* `nil`) - Required. Feature embedding vector for dense index. An array of numbers with the length of [NearestNeighborSearchConfig.dimensions].
  *   `numericRestricts` (*type:* `list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointNumericRestriction.t)`, *default:* `nil`) - Optional. List of Restrict of the datapoint, used to perform "restricted searches" where boolean rule are used to filter the subset of the database eligible for matching. This uses numeric comparisons.
  *   `restricts` (*type:* `list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointRestriction.t)`, *default:* `nil`) - Optional. List of Restrict of the datapoint, used to perform "restricted searches" where boolean rule are used to filter the subset of the database eligible for matching. This uses categorical tokens. See: https://cloud.google.com/vertex-ai/docs/matching-engine/filtering
  *   `sparseEmbedding` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointSparseEmbedding.t`, *default:* `nil`) - Optional. Feature embedding vector for sparse index.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :crowdingTag =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointCrowdingTag.t()
            | nil,
          :datapointId => String.t() | nil,
          :featureVector => list(number()) | nil,
          :numericRestricts =>
            list(
              GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointNumericRestriction.t()
            )
            | nil,
          :restricts =>
            list(
              GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointRestriction.t()
            )
            | nil,
          :sparseEmbedding =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointSparseEmbedding.t()
            | nil
        }

  field(:crowdingTag,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointCrowdingTag
  )

  field(:datapointId)
  field(:featureVector, type: :list)

  field(:numericRestricts,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointNumericRestriction,
    type: :list
  )

  field(:restricts,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointRestriction,
    type: :list
  )

  field(:sparseEmbedding,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapointSparseEmbedding
  )
end

defimpl Poison.Decoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapoint do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapoint.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1IndexDatapoint do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
